#include <stdio.h>
#include <math.h>
#define PI 3.14159

double getRadius ( double surfaceArea , double hight);
double getVolume (double radius , double hight);
double getSlantSide (double hight , double radius);

int main(){
double surfaceArea , hight , volume , slantSide , radius;
printf ("Enter the hight [cm] and surface area [cm2] of a cone: ");
scanf (" %lf%lf" , &hight , &surfaceArea);

radius =  getRadius ( surfaceArea , hight);
slantSide = getSlantSide ( hight , radius);
volume = getVolume ( radius , hight);

printf ("Volume = %.2lf cubic cm\n" , volume );
printf ("slant side = %.2lf cm" , slantSide );
return 0;
}

double getRadius ( double surfaceArea , double hight) {
double radius ;  
radius = sqrt ( (surfaceArea * surfaceArea ) / ( PI * (PI * hight * hight + 2 * surfaceArea)));
return radius;
}

double getVolume (double radius , double hight) {

double volume;
volume = PI * radius * radius * hight / 3;
return volume;
}

double getSlantSide (double hight , double radius){

double slantSide;
slantSide = sqrt ( pow (hight , 2) +  pow (radius , 2) );
return slantSide;
}
